package com.example.administrator.myproject.Adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.myproject.ButtonFragment.YanchuFragment;
import com.example.administrator.myproject.R;

import java.util.BitSet;
import java.util.List;

/**
 * Created by Administrator on 2016/12/14.
 */

public class PopwAdapter extends BaseAdapter {
    private Context context;
    private final LayoutInflater inflater;
    private List<String> nums;

    public PopwAdapter(Context context, List<String> nums) {
        this.context = context;
        this.nums = nums;
        inflater = LayoutInflater.from(context);

    }

    @Override
    public int getCount() {
        return nums != null ? nums.size() : 0;
    }

    @Override
    public Object getItem(int i) {
        return nums != null ? nums.get(i) : null;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            view = inflater.inflate(R.layout.pop_layout, viewGroup, false);
            holder = new ViewHolder();
            holder.tvTime = (TextView) view.findViewById(R.id.tv_time);
            //  holder.tvSort= (TextView) view.findViewById(R.id.tv_sort);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        String num = nums.get(i);
        holder.tvTime.setText(num);
        //  holder.tvSort.setText(num);

        return view;


    }

    class ViewHolder {
        TextView tvTime, tvSort;
    }
}
